{include file="public/header" /}
<style>
    .layui-form-item {
        margin-bottom: 15px !important;
        clear: both;
        *zoom: 1;
    }
    .goBack {
        float: left;
        cursor: pointer;
        font-weight: bold;
        font-size: 15px;
    }
    .center {
        font-weight: bold;
        font-size: 15px;
    }
</style>
<body>
<div class="layui-fluid layui-anim layui-anim-fadein">
    <form action="{:url('save')}" class="layui-form" lay-filter="builderForm" data-token="{$builderTableToken}" data-nav="{$navTitle}" data-just="{$just}">
        <div class="layui-card">
            <div class="layui-card-body" style="padding: 15px;">
                <input type="hidden" name="id" value="{$info.id}">
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>配置标识</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" value="{$info.name}"
                               placeholder="用于config函数调用，只能使用英文且不能重复" lay-verify="required"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>配置标题</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" value="{$info.title}" placeholder="用于后台显示的配置标题"
                               lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>配置描述</label>
                    <div class="layui-input-block">
                        <input type="text" name="remark" value="{$info.remark}" placeholder="配置描述"
                               lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>配置类型</label>
                    <div class="layui-input-inline">
                        <select name="type" lay-filter="call_type">
                            <option value="">请选择</option>
                            <?php foreach(get_config_type() as $k=>$v){?>
                            {if $k > 0}<option <?php if($k == $info->getData('type')){?>selected <?php }?> value="<?php echo $k; ?>"><?php echo $v; ?></option>
                            {/if}
                            <?php }?>
                        </select>
                    </div>
                    <span style="float:left;margin-top: 10px;">
                        如选择“区间”类型,value值将被解析成逗号拼接格式(例如100,1000)
                    </span>
                </div>
                <div class="layui-form-item" id="suffix">
                    <label class="layui-form-label"><span class="x-red">*</span>后缀</label>
                    <div class="layui-input-inline">
                        <select name="suffix">
                            <option value="">请选择</option>
                            <?php foreach(get_suffix() as $k=>$v){?>
                            <option <?php if($v == $info['suffix']){?>selected <?php }?> value="<?php echo $v; ?>"><?php echo $v; ?></option>
                            <?php }?>
                        </select>
                    </div>
                    <span style="float:left;margin-top: 10px;">
                        显示在配置值的后边，仅支持字符、数字、区间类型，例如:200 元(如不需要请忽略)</a>
                    </span>
                </div>
                <div class="layui-form-item" id="time_format" {if !$info.format}style="display: none" {/if}>
                    <label class="layui-form-label"><span class="x-red">*</span>时间格式</label>
                    <div class="layui-input-inline">
                        <select name="format">
                            <option value="">请选择</option>
                            <?php foreach(get_layDate_type() as $k=>$v){?>
                            <option <?php if($k == $info['format']){?>selected <?php }?> value="<?php echo $k; ?>"><?php echo $v; ?></option>
                            <?php }?>
                        </select>
                    </div>
                    <span style="float:left;margin-top: 10px;">
                        具体样式参考:<a target="_blank" href="https://www.layui.com/demo/laydate.html">https://www.layui.com/demo/laydate.html</a>
                    </span>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>配置分组</label>
                    <div class="layui-input-inline">
                        <select name="group">
                            <option value="0">请选择</option>
                            <?php foreach(get_config_group() as $k=>$v){?>
                            <option <?php if($k == $info->getData('group')){?>selected <?php }?> value="<?php echo $k; ?>"><?php echo $v; ?></option>
                            <?php }?>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>配置值</label>
                    <div class="layui-input-block">
                        <input type="text" name="value" {if !$info.format}value="{$info.value}" {/if} placeholder="用于config函数调用显示的值如果是日期型需添加后在编辑日期" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">配置项</label>
                    <div class="layui-input-block">
                        <textarea class="layui-textarea" name="extra"
                                  placeholder="如果是枚举型 需要配置该项">{$info.extra}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="x-red">*</span>排序</label>
                    <div class="layui-input-block">
                        <input type="text" name="sort" value="{$info.sort}" placeholder="用于显示的顺序"
                               lay-verify="required" class="layui-input"/>
                    </div>
                </div>
            </div>
            {include file="public/submit" /}
        </div>
    </form>
</div>
</body>
{include file="public/footer" /}
<script>
    layui.use(['edit'], function () {
        layui.edit.render();
    });
    layui.form.on('select(call_type)', function (obj) {
        var $ = layui.jquery;
        if (obj.value == '7') {
            $("#time_format").css('display', 'block');
        } else {
            $("#time_format").css('display', 'none');
        }
    });
</script>
</html>